import type { DetailsResponse, Response } from '@/http';
import { request } from '@/http';

/**
 * 获取预退款
 */
export function getPreRefund(orderSn: string) {
  return request.post<Response>('/spa/order/applyRefundDetail', { orderSn });
}

/**
 * 获取已退款
 */
export function getRefunded(orderSn: string) {
  return request.post<DetailsResponse>('/spa/order/refundDetail', { orderSn });
}

/**
 * 退款（退款金额为0也需要走下这个接口）
 */
export function refund(orderSn: string) {
  return request.post<Response>('/spa/order/refundOrder', { orderSn, reason: ' ' });
}
